package game.main;

import game.utility.SettingsUtility;

import java.awt.GraphicsConfiguration;
import java.awt.GraphicsEnvironment;

import javax.swing.JFrame;

public class GameFrame extends JFrame {

	public static final int GAME_DEFAULT_WIDTH = 800;
	public static final int GAME_DEFAULT_HEIGHT = 600;

	private static GameFrame SINGLETON;

	static {
		SINGLETON = new GameFrame("PlatformGame", GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration());
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		SettingsUtility.singleton().readSettingsFromFiles();
		GameExecutorThread.singleton().startGame();
	}

	public static final GameFrame singleton() {
		return SINGLETON;
	}

	private GameFrame(String title, GraphicsConfiguration configuration) {
		super(title, null);
		setResizable(false);
		pack();
		setVisible(true);
		setFocusable(true);
		requestFocus();
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setIgnoreRepaint(true);
		setTitle("Game");
		setSize(GAME_DEFAULT_WIDTH, GAME_DEFAULT_HEIGHT);
	}
}